package com.jzo2o.market.controller.inner;

import com.jzo2o.api.market.dto.request.CouponUseReqDTO;
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
import com.jzo2o.api.market.dto.response.CouponUseResDTO;
import com.jzo2o.common.model.CurrentUserInfo;
import com.jzo2o.market.model.dto.request.CouponLimitReqDTO;
import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import com.jzo2o.market.service.ICouponService;
import com.jzo2o.mvc.utils.UserContext;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ Tool：IntelliJ IDEA
 * @ Author：徐茂茂
 * @ Date：2025-10-16-20:55
 * @ Version：1.0
 * @ Description：
 */
@RestController("innerCouponControler")
@RequestMapping("/innner/coupon")
public class couponController {
    @Resource
    private ICouponService couponService;

    @GetMapping("/getAvailable")
    @ApiOperation("获取我的优惠卷列表")
    public List<AvailableCouponsResDTO> getAvailableCoupon(@RequestParam("totalAmount") Long totalAmount,
                                                           @RequestParam("userId") Long userId ){
        return  couponService.getAvailableCoupon(totalAmount,userId);
    }


    @PostMapping("/use")
    @ApiOperation("优惠卷核销")
    public CouponUseResDTO use(@RequestBody CouponUseReqDTO couponUseReqDTO){
        return  couponService.use(couponUseReqDTO);
    }


}
